import { Episodes } from "../../common/CommonConfig";
import { Episodes_get_start, Episodes_get_success, Episodes_get_fail } from "../Type";


const get_Episodes = (animation_id) => {
    console.log(animation_id);
    const formdata = new FormData();
    formdata.append('animation_id', animation_id);
    return (dispatch) => {
        dispatch({
            type: Episodes_get_start,
            msg: "正在加载"
        })
        fetch(Episodes, {
            method: 'POST',
            mode: 'cors',
            body: formdata
        })
            .then(res => {
                return res.json()
            })
            .then(res => {
                if (res.code === 200) {
                    if (res.data.length === 0) {
                        dispatch({
                            type: Episodes_get_success,
                            msg: res.msg,
                            data: [
                                {
                                    "url": "http://50069.gzc.svp.tencent-cloud.com/gzc_1000035_0b53aibeiaaci4apl7nklnqjoawdiqbaerca.f0.mp4"
                                },
                                {
                                    "url": "http://50069.gzc.svp.tencent-cloud.com/gzc_1000035_0bc3oeblcaacxqad5xd5xnqjo4odwfyqfmka.f0.mp4"
                                },
                                {
                                    "url": "http://quan.qq.com/video/1098_4ce183b71fca4244647f13c2162123a4"
                                },
                                {
                                    "url": "http://quan.qq.com/video/1098_16f321eaa984192d8e1841f82c5ff0e8"
                                },
                                {
                                    "url": "http://quan.qq.com/video/1098_684e7caca3f1a2434e89f715c41d4af7"
                                },
                                {
                                    "url": "timeout"
                                },
                                {
                                    "url": "http://quan.qq.com/video/1098_f1d61ce08688bcc132a52d2d96aaa290"
                                },
                                {
                                    "url": "http://quan.qq.com/video/1098_bc17d7922597a6cf779a6e2237b4afcc"
                                },
                                {
                                    "url": "http://quan.qq.com/video/1098_ab0e3953788aa516a95110f9e4c1d335"
                                },
                                {
                                    "url": "http://quan.qq.com/video/1098_666b3862aaf718392e5db5effafc66e3"
                                },
                                {
                                    "url": "timeout"
                                },
                                {
                                    "url": "http://quan.qq.com/video/1098_f574e1c36d11b867f36e30a9b30b8912"
                                },
                                {
                                    "url": "http://quan.qq.com/video/1098_b558026710790ee75d8a3432e1fd9a67"
                                },
                                {
                                    "url": "http://quan.qq.com/video/1098_1842ed156900db482b70e6cf999c5d52"
                                },
                                {
                                    "url": "http://quan.qq.com/video/1098_1730e6020f0d020ef24c48e2fbe67ce9"
                                },
                                {
                                    "url": "http://quan.qq.com/video/1098_12366f41d8c95f6b7986a07698e1c76b"
                                },
                                {
                                    "url": "http://quan.qq.com/video/1098_55413a5cbf8b716614e805be96988af0"
                                },
                                {
                                    "url": "timeout"
                                },
                                {
                                    "url": "http://quan.qq.com/video/1098_5dcf04589317cfd5982798a79d1ea805"
                                },
                                {
                                    "url": "http://quan.qq.com/video/1098_1273644fa24eef53022bc2238f7f96bc"
                                },
                                {
                                    "url": "http://quan.qq.com/video/1098_6760041e4c007a128cb9e5275926250e"
                                },
                                {
                                    "url": "http://quan.qq.com/video/1098_b83b4df0e0d00539f450bfc4e1a47572"
                                },
                                {
                                    "url": "http://quan.qq.com/video/1098_b18a090d5672d2b44d653cf8388766af"
                                },
                                {
                                    "url": "timeout"
                                },
                                {
                                    "url": "http://quan.qq.com/video/1098_15f1f31bdb67cfaa4ee0153aadaeaf72"
                                },
                                {
                                    "url": "http://quan.qq.com/video/1098_a17283c5de8fd95ca6abcd577f46a628"
                                },
                                {
                                    "url": "http://quan.qq.com/video/1098_17ed15f68f7694b92650a8d839229c24"
                                },
                                {
                                    "url": "http://quan.qq.com/video/1098_5bd9bb19cdebb2ccd2b87f18b1f0b894"
                                },
                                {
                                    "url": "http://quan.qq.com/video/1098_5f878653cc63d3554eea1a41940561b6"
                                },
                                {
                                    "url": "timeout"
                                },
                                {
                                    "url": "http://quan.qq.com/video/1098_242d8d9d14e281a6f608537aa09d9977"
                                },
                                {
                                    "url": "http://quan.qq.com/video/1098_19ddfc15ab2239faeb0e48439322c9eb"
                                },
                                {
                                    "url": "http://quan.qq.com/video/1098_5cc6bab26a8c8f3e99300e83127d9b88"
                                },
                                {
                                    "url": "http://quan.qq.com/video/1098_f6a1991e873f2b57c2c39dc69f2bcf8d"
                                },
                                {
                                    "url": "http://quan.qq.com/video/1098_5d40a8e58048378204dba6dcef1aa54e"
                                },
                                {
                                    "url": "http://quan.qq.com/video/1098_e74d9baab3fd843254edca362a250cd5"
                                },
                                {
                                    "url": "http://quan.qq.com/video/1098_ca33b3ad770d318f7274abce0d623d95"
                                },
                                {
                                    "url": "timeout"
                                },
                                {
                                    "url": "http://quan.qq.com/video/1098_215725f84bd6faaa671d9f18ebbfb55b"
                                },
                                {
                                    "url": "http://quan.qq.com/video/1098_2b4931da507ab35bf5e88a7a84fb77bd"
                                },
                                {
                                    "url": "http://quan.qq.com/video/1098_9591ef9f8975b32af974bf97461254e9"
                                },
                                {
                                    "url": "http://quan.qq.com/video/1098_bbbc34ded030f8a7f208a6d6c4be9e3b"
                                },
                                {
                                    "url": "timeout"
                                },
                                {
                                    "url": "http://quan.qq.com/video/1098_0f993c44bd29d09bf0ca0970382bba0a"
                                },
                                {
                                    "url": "http://quan.qq.com/video/1098_4469b2694339fd37ed1669842ee340a1"
                                },
                                {
                                    "url": "http://quan.qq.com/video/1098_5e233861d643cd37cf3f407e782bb68a"
                                },
                                {
                                    "url": "http://quan.qq.com/video/1098_ceca10cd74ea9ef2bf8b4dcb74629450"
                                },
                                {
                                    "url": "http://quan.qq.com/video/1098_37518c619ec66176a630c7724d5b0b40"
                                },
                                {
                                    "url": "http://quan.qq.com/video/1098_c5d291221fa2e90dce678a0be1b62af3"
                                },
                                {
                                    "url": "http://quan.qq.com/video/1098_8863d0d6262b62f51cd28001a599502d"
                                }
                            ]
                        })
                    } else {
                        dispatch({
                            type: Episodes_get_success,
                            msg: res.msg,
                            data: res.data
                        })
                    }
                } else {
                    dispatch({
                        type: Episodes_get_fail,
                        msg: res.msg
                    })
                }
            })
            .catch(res => {
                dispatch({
                    type: Episodes_get_fail,
                    msg: '网络错误' + res
                })
            })
    }
}

export {
    get_Episodes
}